import Vue from 'vue';
import App from './App.vue';
import store from './store';
import api from 'network/api/index';
import util from 'common/util';
import _ from 'lodash';
import i18n from './vue-i18n/vue-i18n';
import router from './router';
import moment from 'moment';
import './sockets/sockets.js';
import { Dialog, Toast } from 'vant';

/**
 * 大学校园跑腿系统
 * created by Daiwanxing on 2019/11/14
 * 系统主入口模块
 */

Vue.prototype.$moment = moment;
Vue.config.productionTip = false;
Vue.prototype.$util = util; // 全局挂载工具类
Vue.prototype.$api = api; // 全局挂载api接口
Vue.use(Dialog, Toast, _);

// 定义全局时间过滤器
Vue.filter('dateformat', function (date, pattern = 'YYYY年MM月DD日 HH:mm:ss') {
    return moment(new Date(date).getTime()).format(pattern);
});

export default new Vue({
    el: '#app',
    router,
    store,
    i18n,
    render: function (createElement) {
        return createElement(App);
    }
});
